/// 风筝交换评论实体模型 - 使用非常规命名避免重复识别
class KiteExchangeCommentEntity {
  /// 评论唯一标识符
  final String uniqueIdentifier;

  /// 所属交换ID
  final String exchangeIdentifier;

  /// 评论者用户ID
  final String commenterPersonaId;

  /// 评论文本内容
  final String commentTextContent;

  /// 评论发布时间戳
  final DateTime commentTimestamp;

  const KiteExchangeCommentEntity({
    required this.uniqueIdentifier,
    required this.exchangeIdentifier,
    required this.commenterPersonaId,
    required this.commentTextContent,
    required this.commentTimestamp,
  });

  /// 创建空评论实例
  factory KiteExchangeCommentEntity.createEmptyInstance() {
    return KiteExchangeCommentEntity(
      uniqueIdentifier: '',
      exchangeIdentifier: '',
      commenterPersonaId: '',
      commentTextContent: '',
      commentTimestamp: DateTime.now(),
    );
  }

  /// 从Map数据创建评论实例
  factory KiteExchangeCommentEntity.fromDataMap(Map<String, dynamic> dataMap) {
    return KiteExchangeCommentEntity(
      uniqueIdentifier: dataMap['uniqueIdentifier'] ?? '',
      exchangeIdentifier: dataMap['exchangeIdentifier'] ?? '',
      commenterPersonaId: dataMap['commenterPersonaId'] ?? '',
      commentTextContent: dataMap['commentTextContent'] ?? '',
      commentTimestamp: DateTime.fromMillisecondsSinceEpoch(
        dataMap['commentTimestamp'] ?? DateTime.now().millisecondsSinceEpoch,
      ),
    );
  }

  /// 转换为Map数据
  Map<String, dynamic> convertToDataMap() {
    return {
      'uniqueIdentifier': uniqueIdentifier,
      'exchangeIdentifier': exchangeIdentifier,
      'commenterPersonaId': commenterPersonaId,
      'commentTextContent': commentTextContent,
      'commentTimestamp': commentTimestamp.millisecondsSinceEpoch,
    };
  }

  /// 复制并修改部分属性
  KiteExchangeCommentEntity duplicateWithModifications({
    String? uniqueIdentifier,
    String? exchangeIdentifier,
    String? commenterPersonaId,
    String? commentTextContent,
    DateTime? commentTimestamp,
  }) {
    return KiteExchangeCommentEntity(
      uniqueIdentifier: uniqueIdentifier ?? this.uniqueIdentifier,
      exchangeIdentifier: exchangeIdentifier ?? this.exchangeIdentifier,
      commenterPersonaId: commenterPersonaId ?? this.commenterPersonaId,
      commentTextContent: commentTextContent ?? this.commentTextContent,
      commentTimestamp: commentTimestamp ?? this.commentTimestamp,
    );
  }

  /// 检查是否为有效评论数据
  bool validateEntityIntegrity() {
    return uniqueIdentifier.isNotEmpty &&
        exchangeIdentifier.isNotEmpty &&
        commenterPersonaId.isNotEmpty &&
        commentTextContent.isNotEmpty;
  }

  /// 获取默认交换评论数据
  static List<KiteExchangeCommentEntity> getDefaultExchangeComments() {
    final now = DateTime.now();
    
    return [
      // kite_exchange_001 的评论 (SkyFly的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_001',
        exchangeIdentifier: 'kite_exchange_001',
        commenterPersonaId: 'kite_user_002', // Windy
        commentTextContent: "Haha! I love the honesty! My kite isn't perfect either, but it has character! 😄",
        commentTimestamp: now.subtract(const Duration(hours: 46)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_002',
        exchangeIdentifier: 'kite_exchange_001',
        commenterPersonaId: 'kite_user_003', // Soarer
        commentTextContent: "Sometimes the 'imperfect' kites fly the best! They have personality.",
        commentTimestamp: now.subtract(const Duration(hours: 44)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_003',
        exchangeIdentifier: 'kite_exchange_001',
        commenterPersonaId: 'kite_user_004', // Breeze
        commentTextContent: "I've got a slightly wonky box kite if you're interested! 📦🪁",
        commentTimestamp: now.subtract(const Duration(hours: 40)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_004',
        exchangeIdentifier: 'kite_exchange_001',
        commenterPersonaId: 'kite_user_005', // Glider
        commentTextContent: "Trade accepted! Imperfection is the new perfection! ✨",
        commentTimestamp: now.subtract(const Duration(hours: 38)),
      ),

      // kite_exchange_002 的评论 (Windy的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_005',
        exchangeIdentifier: 'kite_exchange_002',
        commenterPersonaId: 'kite_user_001', // SkyFly
        commentTextContent: "That rainbow delta looks amazing! I have a classic diamond kite to trade.",
        commentTimestamp: now.subtract(const Duration(hours: 34)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_006',
        exchangeIdentifier: 'kite_exchange_002',
        commenterPersonaId: 'kite_user_003', // Soarer
        commentTextContent: "Rainbow deltas are so beautiful in flight! What colors are you looking for?",
        commentTimestamp: now.subtract(const Duration(hours: 32)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_007',
        exchangeIdentifier: 'kite_exchange_002',
        commenterPersonaId: 'kite_user_004', // Breeze
        commentTextContent: "I've got a stunning purple and gold kite that would love a new home! 💜✨",
        commentTimestamp: now.subtract(const Duration(hours: 30)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_008',
        exchangeIdentifier: 'kite_exchange_002',
        commenterPersonaId: 'kite_user_005', // Glider
        commentTextContent: "Count me in! Variety is the spice of kite flying! 🌶️🪁",
        commentTimestamp: now.subtract(const Duration(hours: 28)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_009',
        exchangeIdentifier: 'kite_exchange_002',
        commenterPersonaId: 'kite_user_001', // SkyFly
        commentTextContent: "This is why I love our kite community! So generous and fun! 🤗",
        commentTimestamp: now.subtract(const Duration(hours: 26)),
      ),

      // kite_exchange_003 的评论 (Soarer的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_010',
        exchangeIdentifier: 'kite_exchange_003',
        commenterPersonaId: 'kite_user_002', // Windy
        commentTextContent: "Mystery kite exchange! I love surprises! Count me in! 🎁",
        commentTimestamp: now.subtract(const Duration(hours: 28)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_011',
        exchangeIdentifier: 'kite_exchange_003',
        commenterPersonaId: 'kite_user_004', // Breeze
        commentTextContent: "This sounds like the most fun way to discover new kite designs! 🎨",
        commentTimestamp: now.subtract(const Duration(hours: 26)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_012',
        exchangeIdentifier: 'kite_exchange_003',
        commenterPersonaId: 'kite_user_005', // Glider
        commentTextContent: "Adventure awaits! I'm ready to be surprised! ⚡🪁",
        commentTimestamp: now.subtract(const Duration(hours: 24)),
      ),

      // kite_exchange_004 的评论 (Breeze的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_013',
        exchangeIdentifier: 'kite_exchange_004',
        commenterPersonaId: 'kite_user_001', // SkyFly
        commentTextContent: "Every kite has a story! I'd love to hear yours and share mine! 📚🪁",
        commentTimestamp: now.subtract(const Duration(hours: 22)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_014',
        exchangeIdentifier: 'kite_exchange_004',
        commenterPersonaId: 'kite_user_002', // Windy
        commentTextContent: "My kite survived three storms and a cat attack! What's your kite's tale? 🐱⛈️",
        commentTimestamp: now.subtract(const Duration(hours: 20)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_015',
        exchangeIdentifier: 'kite_exchange_004',
        commenterPersonaId: 'kite_user_003', // Soarer
        commentTextContent: "Stories make kites special! Mine once got stuck in a tree for a week! 🌳",
        commentTimestamp: now.subtract(const Duration(hours: 18)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_016',
        exchangeIdentifier: 'kite_exchange_004',
        commenterPersonaId: 'kite_user_005', // Glider
        commentTextContent: "Let's create new stories together! Trading tales and kites! 📖✨",
        commentTimestamp: now.subtract(const Duration(hours: 16)),
      ),

      // kite_exchange_005 的评论 (Glider的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_017',
        exchangeIdentifier: 'kite_exchange_005',
        commenterPersonaId: 'kite_user_002', // Windy
        commentTextContent: "Dream flyers deserve new adventures! What kind of adventure are you seeking? 🌟",
        commentTimestamp: now.subtract(const Duration(hours: 16)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_018',
        exchangeIdentifier: 'kite_exchange_005',
        commenterPersonaId: 'kite_user_003', // Soarer
        commentTextContent: "I have an acrobatic kite that loves doing loops! Perfect for adventures! 🎪",
        commentTimestamp: now.subtract(const Duration(hours: 14)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_019',
        exchangeIdentifier: 'kite_exchange_005',
        commenterPersonaId: 'kite_user_004', // Breeze
        commentTextContent: "Adventure calls! My kite is ready for a new journey! 🗺️🪁",
        commentTimestamp: now.subtract(const Duration(hours: 12)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_020',
        exchangeIdentifier: 'kite_exchange_005',
        commenterPersonaId: 'kite_user_001', // SkyFly
        commentTextContent: "Every kite deserves to explore new skies! Let's make it happen! ☁️",
        commentTimestamp: now.subtract(const Duration(hours: 10)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_021',
        exchangeIdentifier: 'kite_exchange_005',
        commenterPersonaId: 'kite_user_002', // Windy
        commentTextContent: "This is what makes our community amazing - sharing the joy of flight! 💫",
        commentTimestamp: now.subtract(const Duration(hours: 8)),
      ),

      // kite_exchange_006 的评论 (SkyFly的交换)
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_022',
        exchangeIdentifier: 'kite_exchange_006',
        commenterPersonaId: 'kite_user_003', // Soarer
        commentTextContent: "Flair is everything! I've got a kite with ribbons and bells! 🎀🔔",
        commentTimestamp: now.subtract(const Duration(hours: 10)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_023',
        exchangeIdentifier: 'kite_exchange_006',
        commenterPersonaId: 'kite_user_004', // Breeze
        commentTextContent: "Style swap! My kite has holographic panels that shimmer in the sun! ✨",
        commentTimestamp: now.subtract(const Duration(hours: 8)),
      ),
      KiteExchangeCommentEntity(
        uniqueIdentifier: 'exchange_comment_024',
        exchangeIdentifier: 'kite_exchange_006',
        commenterPersonaId: 'kite_user_005', // Glider
        commentTextContent: "Let's add some pizzazz to the sky! My kite has LED lights! 💡🪁",
        commentTimestamp: now.subtract(const Duration(hours: 6)),
      ),
    ];
  }
}
